The Begin Tran,commit Tran and rollback TRAN are available in SQL Server 2005/2008 to use transactions.Begin TRAN Indicates the start of a transaction,Commit Tran represents the commit transaction,Rollback TRAN means rolling things backEXEC
SQL Server 2005/2008 provides begin Tran, commit Tran, and rollback Tran to use transactions. Begin Tran indicates that the transaction starts, commit Tran indicates that the transaction is committed, and rollback Tran indicates that the transaction
The usage is as follows:Copy codeThe Code is as follows:-- ===================================================== ======-- Author: cynimoon-- Create date: 2009-10-09-- Description: sample stored procedure-- ============================================
The specific usage is as follows:
Copy Code code as follows:
-- =============================================
--Author:cynimoon
--Create date:2009-10-09
--Description: sample Stored Procedure
-- ======================================
Tran two ways of writing in SQLThe first form of a try catch:BeginTRYBegin Tran Transaction DECLARE @ServiceOrderId INT SET @ServiceOrderId=73342 DECLARE @ErrorCount INT SET @ErrorCount = 0 --Adjust the
-- Typical transaction programming example
-- Begin transaction is the start transaction, commit transaction is the commit transaction, and rollback transaction is the rollback transaction
-- In this example, insert a record first. If an error
Starting with SQL SERVER 2008, we are no longer able to use the previousDUMP TRAN database name with NO_LOGThis way to shrink the database, however, you can use another alternative method, the SQL statement is as follows:ALTER database name set
Stored procedures are like C # methods1. The thing is written in the process, directly call the stored procedure1.1 Procedure with no parameters/*transaction things, procedure stored procedures */create proc copytable_1_10000 asbegin tran--start
Error Handling of nested transactions and transaction retention points
For nested transactions.1. Start external transactions, start internal transactions, and try catchInternal error: if an internal transaction error occurs, internal and
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.